<extend name="Public/layout"/>

<block name="body">
    <div class="row">
        <div class="col-xs-12">
            <div class="box flat box-primary">
                <div class="box-body aaaaaa" id="{$boxId}">
                    <div class="dataTables_tool clearfix" style="margin-top: 10px;">
                        <form>
                            <!-- <div class="input-group date" style="width: 204px; float: left;">
                                <select name="company_id" class="form-control input-sm  select2 list_filter_select">
                                    <option value="0">--请选择公司--</option>
                                    <foreach name="company_list" item="row">
                                        <option value="{$row['id']}" {:I('get.company_id')==$row['id'] ? 'selected="selected"' : ''}>{$row['name']}</option>
                                    </foreach>
                                </select>
                            </div> -->
                           <!--  <div class="input-group date" style="width: 204px; float: left;margin:0 10px;">
                                <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                               
                                <input style="width: auto;" type="text" data-name="no" name="no"
                                       class="form-control" value="{:I('get.no')}"
                                       placeholder="请填写城市合伙人编号"/>
                            </div> -->
                         
                            <div class="input-group date" style="width: 204px; float: left;">
                                <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                <input type="hidden" name="start_time" class="text date"
                                       value="{:I('get.start_time')}"/>
                                <input style="width: auto;" type="text" data-name="start_time"
                                       class="form-control date datepicker" value="{:I('get.start_time')}"
                                       placeholder="请选择开始日期"
                                       data-type="date"/>
                            </div>
                            <div class="input-group date" style="width: 204px; float: left;margin-left: 10px;">
                                <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                <input type="hidden" name="end_time" class="text date"
                                       value="{:I('get.end_time')}"/>
                                <input style="width: auto;" type="text" data-name="end_time"
                                       class="form-control date datepicker" value="{:I('get.end_time')}"
                                       placeholder="请选择结束日期"
                                       data-type="date"/>
                            </div>
                            
<!--                             <div class="input-group date" style="width: 104px; float: left;margin-left: 10px;margin-top: 6px;">
                                 导出报表
                                <input style="width: auto;" type="checkbox" data-name="is_load"
                                       class="iradio_minimal-blue" value="1" name ='is_load'
                                       />
                            </div> -->
                            <button style="line-height: 20px;margin-top:auto;margin-left: 10px;" type="submit"
                                    class="btn btn-flat _dt_btns_ btn-default" data-callback="form"
                                    data-param="">
                                搜索
                            </button>
                           
                        </form>
                    </div>
                    
                    <div class="table-wrap">
                        <table id="{$tableId}"
                               class="table table-bordered table-hover table-condensed table-nowrap"
                               data-table-name="{$tableId}">
                            <thead>
                            <tr>
                                <th title="日期" rowspan="2" style="text-align: center;vertical-align: middle;">日期</th>
                                <th title="已领取人数" rowspan="2" style="text-align: center;vertical-align: middle;">已领取人数</th>
                                <th title="红包金额" colspan="3" style="text-align: center">红包金额</th>
                                
                            </tr>
                            <tr>
                                <!-- <th title="当天应领取总人数" style="text-align: center">当天应领取总人数</th>
                                <th title="当天已领取人数" style="text-align: center">当天已领取人数</th>
                                <th title="当天未领取人数" style="text-align: center">当天未领取人数</th> -->
                                <th title="当天产生红包总金额" style="text-align: center">当天产生红包总金额</th>
                                <th title="当天已领取红包金额" style="text-align: center">当天已领取红包金额</th>
                                <th title="当天未领取红包金额" style="text-align: center">当天未领取红包金额</th>
                            </tr>
                            </thead>
                            <tbody>
                            <foreach name="list" item="row">
                                <tr>
                                    <td title="{$row['date']}" style="text-align: center">{$row['date']}</td>
                                   <!--  <td title="{$row['total_count']}" style="text-align: center">{$row['total_count']}</td> -->
                                    <td title="{$row['yl_count']}" style="text-align: center">{$row['yl_count']}</td>
                                    <!-- <td title="{$row['wl_count']}" style="text-align: center">{$row['wl_count']}</td> -->
                                    <td title="{$row['total_red_packets_quota']}" style="text-align: center">{$row['total_red_packets_quota']}</td>
                                    <td title="{$row['yl_red_packets_quota']}" style="text-align: center">{$row['yl_red_packets_quota']}</td>
                                    <td title="{$row['wl_red_packets_quota']}" style="text-align: center">{$row['wl_red_packets_quota']}</td>
                                    
                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        $(function () {
            $('.form-control.date.datepicker').change(function () {
                $(this).prev().val($(this).val());
            });

            $('.datepicker').each(function () {
                var $this = $(this);
                var dateType = $(this).attr('data-type');
                var handle = "datepicker";
                var format = "yyyy-mm-dd";
                var options = {
                    language: 'zh-CN',
                    autoclose: true,
                    templates: {
                        leftArrow: '<i class="fa fa-caret-square-o-left"></i>',
                        rightArrow: '<i class="fa fa-long-arrow-right"></i>'
                    },
                }
                switch (dateType) {
                    case 'timestamp':
                    case 'datetime':
                        format = "yyyy-mm-dd hh:ii";
                        handle = 'datetimepicker';
                        break;
                    case 'date':
                        format = "yyyy-mm-dd";
                        handle = 'datepicker';
                        break;
                }
                options.format = format;
                var fieldName = $this.attr('data-name');
                $this[handle](options)
                    .on('changeDate,change', function (e) {
                        var value = $(e.currentTarget).val();
                        $('input[name=' + fieldName + ']').val(value);
                    });
            });
        });
    </script>
</block>